package gui;

import java.io.UnsupportedEncodingException;
import java.security.NoSuchAlgorithmException;
import java.util.logging.Level;
import java.util.logging.Logger;
import source.*;
/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/**
 *
 * @author BrunoCardoso
 */
public class removerUtilizador extends javax.swing.JFrame {
    DatabaseHandler connect;
    int id;
    String username;
    /**
     * Creates new form removerUtilizador
     */
    public removerUtilizador(DatabaseHandler conn, String usernameReceived, int idReceived) {
        id = idReceived;
        username = usernameReceived;
        connect = conn;
        initComponents();
        this.setLocation((1366 - this.getWidth()) / 2, (768 - this.getHeight()) / 2);
    }

    /**
     * This method is called from within the constructor to initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is always
     * regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        jPanel1 = new javax.swing.JPanel();
        jLabel1 = new javax.swing.JLabel();
        jPanel2 = new javax.swing.JPanel();
        jLabel2 = new javax.swing.JLabel();
        jLabel3 = new javax.swing.JLabel();
        passwordText = new javax.swing.JPasswordField();
        repeatPasswordText = new javax.swing.JPasswordField();
        eliminartodosdados = new javax.swing.JCheckBox();
        jPanel3 = new javax.swing.JPanel();
        buttonRemover = new javax.swing.JButton();
        buttonVoltar = new javax.swing.JButton();
        barraMenus = new javax.swing.JMenuBar();
        menuPrincipal = new javax.swing.JMenu();
        botaoUtilizadorMenuPrincipal = new javax.swing.JMenuItem();
        menuMensagensPrivadas = new javax.swing.JMenu();
        botaoUtilizadorMenuMensagensPrivadas = new javax.swing.JMenuItem();
        botaoUtilizadorMensagensEnviadas = new javax.swing.JMenuItem();
        botaoUtilizadorMensagensRecebidas = new javax.swing.JMenuItem();
        botaoMenuMensagensNovas = new javax.swing.JMenuItem();
        menuPerfil = new javax.swing.JMenu();
        botaoParaUtilizadorMenuEditarPerfil = new javax.swing.JMenuItem();
        botaoRemoveSai = new javax.swing.JMenuItem();
        menuProcurar = new javax.swing.JMenu();
        botaoMenuProcurarUtilizador = new javax.swing.JMenuItem();
        menuSalas = new javax.swing.JMenu();
        botaoMinhasSalas = new javax.swing.JMenuItem();
        botaoPesquisarSalas = new javax.swing.JMenuItem();

        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);

        jLabel1.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
        jLabel1.setText("Remover Conta");

        javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
        jPanel1.setLayout(jPanel1Layout);
        jPanel1Layout.setHorizontalGroup(
            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel1Layout.createSequentialGroup()
                .addGap(180, 180, 180)
                .addComponent(jLabel1)
                .addContainerGap(158, Short.MAX_VALUE))
        );
        jPanel1Layout.setVerticalGroup(
            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel1Layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jLabel1)
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );

        jLabel2.setText("Insira a sua Password:");

        jLabel3.setText("Repita a sua Password:");

        eliminartodosdados.setText("Eliminar a minha informação toda.");
        eliminartodosdados.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                eliminartodosdadosActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout jPanel2Layout = new javax.swing.GroupLayout(jPanel2);
        jPanel2.setLayout(jPanel2Layout);
        jPanel2Layout.setHorizontalGroup(
            jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel2Layout.createSequentialGroup()
                .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPanel2Layout.createSequentialGroup()
                        .addGap(19, 19, 19)
                        .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(jLabel3)
                            .addComponent(jLabel2))
                        .addGap(18, 18, 18)
                        .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                            .addComponent(passwordText, javax.swing.GroupLayout.DEFAULT_SIZE, 138, Short.MAX_VALUE)
                            .addComponent(repeatPasswordText)))
                    .addGroup(jPanel2Layout.createSequentialGroup()
                        .addContainerGap()
                        .addComponent(eliminartodosdados)))
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );
        jPanel2Layout.setVerticalGroup(
            jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel2Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel2)
                    .addComponent(passwordText, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(18, 18, 18)
                .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel3)
                    .addComponent(repeatPasswordText, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 21, Short.MAX_VALUE)
                .addComponent(eliminartodosdados, javax.swing.GroupLayout.PREFERRED_SIZE, 23, javax.swing.GroupLayout.PREFERRED_SIZE))
        );

        buttonRemover.setText("Remover");
        buttonRemover.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                buttonRemoverActionPerformed(evt);
            }
        });

        buttonVoltar.setText("Voltar");
        buttonVoltar.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                buttonVoltarActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout jPanel3Layout = new javax.swing.GroupLayout(jPanel3);
        jPanel3.setLayout(jPanel3Layout);
        jPanel3Layout.setHorizontalGroup(
            jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel3Layout.createSequentialGroup()
                .addGap(20, 20, 20)
                .addComponent(buttonVoltar)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 26, Short.MAX_VALUE)
                .addComponent(buttonRemover)
                .addContainerGap())
        );
        jPanel3Layout.setVerticalGroup(
            jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel3Layout.createSequentialGroup()
                .addContainerGap(32, Short.MAX_VALUE)
                .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(buttonRemover, javax.swing.GroupLayout.PREFERRED_SIZE, 39, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(buttonVoltar))
                .addGap(29, 29, 29))
        );

        menuPrincipal.setText("Menu Principal");

        botaoUtilizadorMenuPrincipal.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_H, java.awt.event.InputEvent.CTRL_MASK));
        botaoUtilizadorMenuPrincipal.setIcon(new javax.swing.ImageIcon(getClass().getResource("/images/home-icon.png"))); // NOI18N
        botaoUtilizadorMenuPrincipal.setText("Home");
        botaoUtilizadorMenuPrincipal.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                botaoUtilizadorMenuPrincipalActionPerformed(evt);
            }
        });
        menuPrincipal.add(botaoUtilizadorMenuPrincipal);

        barraMenus.add(menuPrincipal);

        menuMensagensPrivadas.setText("Mensagens Privadas");

        botaoUtilizadorMenuMensagensPrivadas.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_C, java.awt.event.InputEvent.SHIFT_MASK | java.awt.event.InputEvent.CTRL_MASK));
        botaoUtilizadorMenuMensagensPrivadas.setIcon(new javax.swing.ImageIcon(getClass().getResource("/images/icon mensagem nova.png"))); // NOI18N
        botaoUtilizadorMenuMensagensPrivadas.setText("Criar");
        botaoUtilizadorMenuMensagensPrivadas.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                botaoUtilizadorMenuMensagensPrivadasActionPerformed(evt);
            }
        });
        menuMensagensPrivadas.add(botaoUtilizadorMenuMensagensPrivadas);

        botaoUtilizadorMensagensEnviadas.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_E, java.awt.event.InputEvent.SHIFT_MASK | java.awt.event.InputEvent.CTRL_MASK));
        botaoUtilizadorMensagensEnviadas.setIcon(new javax.swing.ImageIcon(getClass().getResource("/images/icon mensagem enviadas.png"))); // NOI18N
        botaoUtilizadorMensagensEnviadas.setText("Enviadas");
        botaoUtilizadorMensagensEnviadas.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                botaoUtilizadorMensagensEnviadasActionPerformed(evt);
            }
        });
        menuMensagensPrivadas.add(botaoUtilizadorMensagensEnviadas);

        botaoUtilizadorMensagensRecebidas.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_R, java.awt.event.InputEvent.SHIFT_MASK | java.awt.event.InputEvent.CTRL_MASK));
        botaoUtilizadorMensagensRecebidas.setIcon(new javax.swing.ImageIcon(getClass().getResource("/images/icon mensagens recebidas.png"))); // NOI18N
        botaoUtilizadorMensagensRecebidas.setText("Recebidas");
        botaoUtilizadorMensagensRecebidas.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                botaoUtilizadorMensagensRecebidasActionPerformed(evt);
            }
        });
        menuMensagensPrivadas.add(botaoUtilizadorMensagensRecebidas);

        botaoMenuMensagensNovas.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_N, java.awt.event.InputEvent.CTRL_MASK));
        botaoMenuMensagensNovas.setIcon(new javax.swing.ImageIcon(getClass().getResource("/images/1355506850_label_new blue.png"))); // NOI18N
        botaoMenuMensagensNovas.setText("Novas Mensagens");
        botaoMenuMensagensNovas.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                botaoMenuMensagensNovasActionPerformed(evt);
            }
        });
        menuMensagensPrivadas.add(botaoMenuMensagensNovas);

        barraMenus.add(menuMensagensPrivadas);

        menuPerfil.setText("Perfil");

        botaoParaUtilizadorMenuEditarPerfil.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_E, java.awt.event.InputEvent.CTRL_MASK));
        botaoParaUtilizadorMenuEditarPerfil.setIcon(new javax.swing.ImageIcon(getClass().getResource("/images/icon editar perfil.png"))); // NOI18N
        botaoParaUtilizadorMenuEditarPerfil.setText("Editar");
        botaoParaUtilizadorMenuEditarPerfil.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                botaoParaUtilizadorMenuEditarPerfilActionPerformed(evt);
            }
        });
        menuPerfil.add(botaoParaUtilizadorMenuEditarPerfil);

        botaoRemoveSai.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_R, java.awt.event.InputEvent.CTRL_MASK));
        botaoRemoveSai.setIcon(new javax.swing.ImageIcon(getClass().getResource("/images/icon remover utilizador.png"))); // NOI18N
        botaoRemoveSai.setText("Remover");
        botaoRemoveSai.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                botaoRemoveSaiActionPerformed(evt);
            }
        });
        menuPerfil.add(botaoRemoveSai);

        barraMenus.add(menuPerfil);

        menuProcurar.setText("Procurar Utilizadores");

        botaoMenuProcurarUtilizador.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_P, java.awt.event.InputEvent.CTRL_MASK));
        botaoMenuProcurarUtilizador.setIcon(new javax.swing.ImageIcon(getClass().getResource("/images/icon procurar utilizador.png"))); // NOI18N
        botaoMenuProcurarUtilizador.setText("Procurar");
        botaoMenuProcurarUtilizador.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                botaoMenuProcurarUtilizadorActionPerformed(evt);
            }
        });
        menuProcurar.add(botaoMenuProcurarUtilizador);

        barraMenus.add(menuProcurar);

        menuSalas.setText("Salas");

        botaoMinhasSalas.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_M, java.awt.event.InputEvent.CTRL_MASK));
        botaoMinhasSalas.setIcon(new javax.swing.ImageIcon(getClass().getResource("/images/icon minhas salas.png"))); // NOI18N
        botaoMinhasSalas.setText("Minhas Salas");
        botaoMinhasSalas.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                botaoMinhasSalasActionPerformed(evt);
            }
        });
        menuSalas.add(botaoMinhasSalas);

        botaoPesquisarSalas.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_S, java.awt.event.InputEvent.CTRL_MASK));
        botaoPesquisarSalas.setIcon(new javax.swing.ImageIcon(getClass().getResource("/images/icon procurar sala.png"))); // NOI18N
        botaoPesquisarSalas.setText("Pesquisar");
        botaoPesquisarSalas.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                botaoPesquisarSalasActionPerformed(evt);
            }
        });
        menuSalas.add(botaoPesquisarSalas);

        barraMenus.add(menuSalas);

        setJMenuBar(barraMenus);

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
            .addGroup(layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jPanel2, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
                        .addGap(0, 0, Short.MAX_VALUE)
                        .addComponent(jPanel3, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
                .addContainerGap())
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addGap(12, 12, 12)
                .addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(18, 18, 18)
                .addComponent(jPanel2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 31, Short.MAX_VALUE)
                .addComponent(jPanel3, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap())
        );

        pack();
    }// </editor-fold>//GEN-END:initComponents

    private void buttonRemoverActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_buttonRemoverActionPerformed
        // TODO add your handling code here:
        String dbPassword = connect.getPassword(username);
        
        String password = "";
        try {
            password = PasswordEncrypt.MD5(passwordText.getText());
        } catch (NoSuchAlgorithmException ex) {
            Logger.getLogger(removerUtilizador.class.getName()).log(Level.SEVERE, null, ex);
        } catch (UnsupportedEncodingException ex) {
            Logger.getLogger(removerUtilizador.class.getName()).log(Level.SEVERE, null, ex);
        }
        
        String repeatPassword = "";
        try {
            repeatPassword = PasswordEncrypt.MD5(repeatPasswordText.getText());
        } catch (NoSuchAlgorithmException ex) {
            Logger.getLogger(removerUtilizador.class.getName()).log(Level.SEVERE, null, ex);
        } catch (UnsupportedEncodingException ex) {
            Logger.getLogger(removerUtilizador.class.getName()).log(Level.SEVERE, null, ex);
        }
        
        System.out.println("DB>"+dbPassword+"\np1>"+password+"\np2>"+repeatPassword);
        
        if(password.equals(repeatPassword) && dbPassword.equals(password)){
            if(eliminartodosdados.isSelected()){
                this.setVisible(false);
                removerErroPopup popup= new removerErroPopup(connect, username, dbPassword,1);
                popup.setVisible(true);
            }
            else{
                this.setVisible(false);
                removerErroPopup popup= new removerErroPopup(connect, username, dbPassword,0);
                popup.setVisible(true);
            }

            
        }
    }//GEN-LAST:event_buttonRemoverActionPerformed

    private void buttonVoltarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_buttonVoltarActionPerformed
        // TODO add your handling code here:
        this.setVisible(false);
        UtilizadorMenuPrincipal menu = new UtilizadorMenuPrincipal(connect, username, id);
        menu.setVisible(true);
    }//GEN-LAST:event_buttonVoltarActionPerformed

    private void botaoUtilizadorMenuPrincipalActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_botaoUtilizadorMenuPrincipalActionPerformed
        // TODO add your handling code here:
        this.setVisible(false);
        UtilizadorMenuPrincipal menu = new UtilizadorMenuPrincipal(connect, username, id);
        menu.setVisible(true);
    }//GEN-LAST:event_botaoUtilizadorMenuPrincipalActionPerformed

    private void botaoUtilizadorMenuMensagensPrivadasActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_botaoUtilizadorMenuMensagensPrivadasActionPerformed
        // TODO add your handling code here:
        this.setVisible(false);
        UtilizadorMenuMensagensPrivadas menu = new UtilizadorMenuMensagensPrivadas(connect, username, id);
        menu.setVisible(true);
    }//GEN-LAST:event_botaoUtilizadorMenuMensagensPrivadasActionPerformed

    private void botaoUtilizadorMensagensEnviadasActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_botaoUtilizadorMensagensEnviadasActionPerformed
        // TODO add your handling code here:
        this.setVisible(false);
        UtilizadorMensagensEnviadas menu = new UtilizadorMensagensEnviadas(connect, username, id);
        menu.setVisible(true);
    }//GEN-LAST:event_botaoUtilizadorMensagensEnviadasActionPerformed

    private void botaoUtilizadorMensagensRecebidasActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_botaoUtilizadorMensagensRecebidasActionPerformed
        // TODO add your handling code here:
        this.setVisible(false);
        UtilizadorMensagensRecebidas menu = new UtilizadorMensagensRecebidas(connect, username, id);
        menu.setVisible(true);
    }//GEN-LAST:event_botaoUtilizadorMensagensRecebidasActionPerformed

    private void botaoMenuMensagensNovasActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_botaoMenuMensagensNovasActionPerformed
        // TODO add your handling code here:
        this.setVisible(false);
        UtilizadorMensagensRecebidasNovas menu = new UtilizadorMensagensRecebidasNovas(connect, username, id);
        menu.setVisible(true);
    }//GEN-LAST:event_botaoMenuMensagensNovasActionPerformed

    private void botaoParaUtilizadorMenuEditarPerfilActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_botaoParaUtilizadorMenuEditarPerfilActionPerformed
        // TODO add your handling code here:
        this.setVisible(false);
        UtilizadorMenuEditarPerfil menu = new UtilizadorMenuEditarPerfil(connect, username, id);
        menu.setVisible(true);
    }//GEN-LAST:event_botaoParaUtilizadorMenuEditarPerfilActionPerformed

    private void botaoRemoveSaiActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_botaoRemoveSaiActionPerformed
        // TODO add your handling code here:
        this.setVisible(false);
        removerUtilizador menu = new removerUtilizador(connect, username, id);
        menu.setVisible(true);
    }//GEN-LAST:event_botaoRemoveSaiActionPerformed

    private void botaoMenuProcurarUtilizadorActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_botaoMenuProcurarUtilizadorActionPerformed
        // TODO add your handling code here:
        this.setVisible(false);
        procurarUtilizadores menu = new procurarUtilizadores(connect, username, id);
        menu.setVisible(true);
    }//GEN-LAST:event_botaoMenuProcurarUtilizadorActionPerformed

    private void botaoMinhasSalasActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_botaoMinhasSalasActionPerformed
        // TODO add your handling code here:
        this.setVisible(false);
        UtilizadorMenuMinhasSalas menu = new UtilizadorMenuMinhasSalas(connect, username, id);
        menu.setVisible(true);
    }//GEN-LAST:event_botaoMinhasSalasActionPerformed

    private void botaoPesquisarSalasActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_botaoPesquisarSalasActionPerformed
        // TODO add your handling code here:
        this.setVisible(false);
        UtilizadorMenuPesquisarSalas menu = new UtilizadorMenuPesquisarSalas(connect, username, id);
        menu.setVisible(true);
    }//GEN-LAST:event_botaoPesquisarSalasActionPerformed

    private void eliminartodosdadosActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_eliminartodosdadosActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_eliminartodosdadosActionPerformed


    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JMenuBar barraMenus;
    private javax.swing.JMenuItem botaoMenuMensagensNovas;
    private javax.swing.JMenuItem botaoMenuProcurarUtilizador;
    private javax.swing.JMenuItem botaoMinhasSalas;
    private javax.swing.JMenuItem botaoParaUtilizadorMenuEditarPerfil;
    private javax.swing.JMenuItem botaoPesquisarSalas;
    private javax.swing.JMenuItem botaoRemoveSai;
    private javax.swing.JMenuItem botaoUtilizadorMensagensEnviadas;
    private javax.swing.JMenuItem botaoUtilizadorMensagensRecebidas;
    private javax.swing.JMenuItem botaoUtilizadorMenuMensagensPrivadas;
    private javax.swing.JMenuItem botaoUtilizadorMenuPrincipal;
    private javax.swing.JButton buttonRemover;
    private javax.swing.JButton buttonVoltar;
    private javax.swing.JCheckBox eliminartodosdados;
    private javax.swing.JLabel jLabel1;
    private javax.swing.JLabel jLabel2;
    private javax.swing.JLabel jLabel3;
    private javax.swing.JPanel jPanel1;
    private javax.swing.JPanel jPanel2;
    private javax.swing.JPanel jPanel3;
    private javax.swing.JMenu menuMensagensPrivadas;
    private javax.swing.JMenu menuPerfil;
    private javax.swing.JMenu menuPrincipal;
    private javax.swing.JMenu menuProcurar;
    private javax.swing.JMenu menuSalas;
    private javax.swing.JPasswordField passwordText;
    private javax.swing.JPasswordField repeatPasswordText;
    // End of variables declaration//GEN-END:variables
}
